<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Program extends Model
{
    public function joinMembers(){
        return $this->hasMany(Member::class);
    }
    public function member(){
        return $this->belongsTo(Member::class);
    }
    public function getMembersAttribute($value)
    {
        return explode(',', $value);
    }

    public function setMembersAttribute($value)
    {
        $this->attributes['members'] = implode(',', $value);
    }
}
